Skip to content
Snippets Groups Projects
Commit 573e95cb authored by Alessandro Elias's avatar Alessandro Elias
Browse files

Merge branch 'issue/297' into 'master'

SCRUM#297 - Separate family-shield and le-conf

See merge request !1
parents 40b1b095 190bc641
No related branches found
No related tags found
1 merge request!1SCRUM#297 - Separate family-shield and le-conf
Pipeline #
#!/bin/bash
# This script generates a .deb package
apt-get update && apt-get install -y devscripts
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo $LINE | cut -d' ' -f1)
VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
tar --exclude=debian -czf ${PACKAGE}_${VERSION}.orig.tar.gz package/*
cd package
debuild -us -uc --lintian-opts --profile debian
cd ../
mkdir build/
mv ${PACKAGE}* build/
#!/bin/bash
# This script uploads an includes a .deb package in our debian repository.
# The distribution is chosen based on the gitlab-ci stage we are on.
apt-get update && apt-get install -y dput ssh
eval $(ssh-agent -s)
ssh-add <(echo "$PRIV_KEY")
echo "Deploy job name: $CI_JOB_NAME"
if [ "$CI_JOB_NAME" = "deploy_for_testing" ]; then
dput -u -f --config=dput.cf repo build/*.changes
elif [ "$CI_JOB_NAME" = "deploy_for_stable" ]; then
CHANGELOG="package/debian/changelog"
LINE=$(head -n 1 $CHANGELOG)
PACKAGE=$(echo $LINE | cut -d' ' -f1)
VERSION=$(echo $LINE | cut -d' ' -f2 | grep -o -E '[0-9]*\.[0-9]*\.[0-9]*')
REPREPRO_CMD="reprepro -Vb /home/repository/www/le6 copysrc stable testing $PACKAGE $VERSION"
ssh -o StrictHostKeyChecking=no -i ~/.ssh/id_rsa repository@repo.c3sl.ufpr.br "$REPREPRO_CMD"
fi
package/debian/le-parental-control.debhelper.log
package/debian/le-parental-control.substvars
package/debian/le-parental-control.*.debhelper
package/debian/files
package/debian/debhelper-build-stamp
le-parental-control_*.tar.xz
le-parental-control_*.build
le-parental-control_*.dsc
le-parental-control_*.changes
le-parental-control_*.deb
build.sh
## Template para empacotamento utilizando o Gitlab-ci.
stages:
- build
- test
- deploy
build:
stage: build
artifacts:
paths:
- build/
tags:
- ubuntu
- regular
script:
- apt-get update && apt-get install -y build-essential devscripts dh-make dh-systemd quilt
- ./.build.sh
test:
stage: test
tags:
- ubuntu
- regular
script:
# TODO: find a way to get the dependencies automatically
- apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y locales language-pack-gnome-pt language-pack-pt-base
- locale-gen pt_BR.UTF-8
- export LANG=pt_BR.UTF-8
- DEBIAN_FRONTEND=noninteractive apt-get -y install $(pwd)/build/*.deb
dependencies:
- build
deploy_for_testing:
stage: deploy
only:
- master
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
deploy_for_stable:
stage: deploy
when: manual
only:
- master
tags:
- debian-packaging
script:
- ./.deploy.sh
dependencies:
- build
[repo]
fqdn = repo.c3sl.ufpr.br
method = scp
login = repository
incoming = /home/repository/www/le6/incoming
allow_unsigned_uploads = 1
ssh_config_options = User=repository
StrictHostKeyChecking=no
post_upload_command = ssh -l repository -i ~/.ssh/id_rsa repo.c3sl.ufpr.br "reprepro -Vb /home/repository/www/le6 processincoming default"
le-parental-control (0.0.1) testing; urgency=medium
* Separate family-shield and le-conf
-- Andre Luis da Silva Machado <contato@c3sl.ufpr.br> Fri, 09 Feb 2018 11:48:02 -0200
9
Source: le-parental-control
Section: admin
Priority: extra
Maintainer: Andre Luis da Silva Machado <contato@c3sl.ufpr.br>
Build-Depends: debhelper (>=9)
Standards-Version: 3.9.7
Vcs-Git: https://gitlab.c3sl.ufpr.br/le6/le-parental-control.git
Package: le-parental-control
Architecture: all
Depends: ${misc:Depends}
Recommends: le-help, le-conf
Description: Configure Family Shield
Performs all configuration for Family Shield.
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: le-parental-control
Source: https://gitlab.c3sl.ufpr.br/le6/le-conf.git
Files: *
Copyright: 2018 Andre Luis da Silva Machado <alsm14@c3sl.ufpr.br>
2018 C3SL <contato@c3sl.ufpr.br>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
family-shield usr/bin
help/le-conf-controle-parental.page usr/share/help-langpack/pt_BR/le-help/
binary-without-manpage
#!/bin/bash
#
# Copyright (C) 2018 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-parental-control
#
# le6-conf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
set -e
case "$1" in
configure|triggered)
############## Family Shield ##############
if [ ! -z "$2" ]; then
echo "Setting family-shield"
prof_line="%professor ALL=(ALL:ALL) NOPASSWD: /usr/bin/family-shield"
admin_line="%admin ALL=(ALL:ALL) NOPASSWD: /usr/bin/family-shield"
chmod 550 /usr/bin/family-shield
if ! grep -Fxq "$prof_line" /etc/sudoers ; then
echo "$prof_line" >> /etc/sudoers
fi
if ! grep -Fxq "$admin_line" /etc/sudoers ; then
echo "$admin_line" >> /etc/sudoers
fi
family-shield -e
# Restart le-lab after adding services
dbus-send --system --type=method_call --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.restart || true
fi
################## Manual ####################
dir="/usr/share/help/pt_BR/le-help"
if [ ! -d $dir ];then
mkdir -p $dir
fi
if [ ! -L /usr/share/help/pt_BR/le-help/le-conf-controle-parental.page ];then
ln -s /usr/share/help-langpack/pt_BR/le-help/le-conf-controle-parental.page /usr/share/help/pt_BR/le-help/le-conf-controle-parental.page
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
exit 0
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0
#!/bin/bash
#
# Copyright (C) 2016 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-conf
#
# le6-conf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
set -e
rm /usr/share/help/pt_BR/le-help/le-conf-controle-parental.page
#DEBHELPER#
#!/usr/bin/make -f
%:
dh $@
#!/bin/bash
# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR
#
# This file is part of le-conf
#
# le-conf is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
# USA.
# The family-shield service provide these two DNS servers
server1="nameserver 208.67.222.222"
server2="nameserver 208.67.220.220"
# And we need to guarantee that these servers will supersede others in address search
domainsupersede="supersede domain-name-servers 208.67.222.222,208.67.220.220;"
# The supersede line must be inserted before the pivot line
pivot_line="require subnet-mask, domain-name-servers;"
# DNS resolve configuration
conf_file="/etc/resolv.conf.auto"
# DCHP configuration
dhcp_file="/etc/dhcp/dhclient.conf"
function check_status() {
if grep -Fxq "#$domainsupersede" "$dhcp_file" ; then # line is present but commented
echo 1
elif grep -Fxq "$domainsupersede" "$dhcp_file"; then # domainsupersede line is present on file
echo 0
else
echo 2
fi
}
function enable_family() {
message="could not enable Family Shield"
if [[ $(check_status) -eq 0 ]]; then
message="Family Shield already enabled"
elif [[ $(check_status) -eq 1 ]]; then # uncomment line
sed -i "/#$domainsupersede/s/^#//" $dhcp_file
service network-manager restart
message="Family Shield enabled"
elif [[ $(check_status) -eq 2 ]]; then # insert line
sed "s/$pivot_line/$pivot_line\n$domainsupersede/" $dhcp_file
service network-manager restart
message="Family Shield enabled"
fi
echo "$message"
}
function disable_family() {
if [[ $(check_status) -eq 0 ]]; then # comment line
sed -i "/$domainsupersede/s/^/#/" $dhcp_file
service network-manager restart
echo "Family Shield disabled"
else
echo "Family Shield already disabled"
fi
}
# When advertising, we need to remove the service from the network
# To make sure that we can advertise the same command later
function advertise_enable() {
# Try to remove the disable family-shield service from network
dbus-send --system --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.remove_local_service string:'disableFamilyShield'
# Advertise enable service
dbus-send --system --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.advertise_local_service string:'enableFamilyShield'
}
function advertise_disable() {
# Try to remove the enable family-shield service from network
dbus-send --system --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.remove_local_service string:'enableFamilyShield'
# Advertise enable service
dbus-send --system --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.advertise_local_service string:'disableFamilyShield'
}
function check_services() {
serviceActive=`dbus-send --system --print-reply --dest=br.ufpr.c3sl.lelab /br/ufpr/c3sl/lelab br.ufpr.c3sl.lelab.Action.get_network_service_list string:'enableFamilyShield' | grep string`
if test "$serviceActive"; then
echo "Family Shield is on local network"
else
echo "No Family Shield service active on local network"
fi
}
while test $# -gt 0
do
case $1 in
--enable|-e)
ENABLE=true
shift
;;
--disable|-d)
DISABLE=true
shift
;;
--network|-n)
NETWORK=true
shift
;;
--status|-s)
STATUS=true
shift
;;
--help|-h)
echo "Usage: family-shield [OPTION]"
echo
echo " -h, --help display this help."
echo " -e, --enable enable Family Shield."
echo " -d, --disable disable Family Shield."
echo " -s, --status return Family Shield status (enabled or disabled)."
echo " -n, --network apply Family Shield changes on local network via le-lab"
exit 1
;;
"")
echo "family-shield: missing operand"
echo "Try 'family-shield --help' for more information."
exit 1
;;
*)
echo "family-shield: invalid option '$1'"
echo "Try 'family-shield --help' for more information."
exit 1
;;
esac
done
if test $STATUS; then
if test $NETWORK; then
check_services
else
if [[ $(check_status) == 0 ]]; then
echo "Family Shield is enabled"
else
echo "Family Shield is disabled"
fi
fi
exit 1
fi
# Below this point we edit files that need sudo access
# As such, we need to check writing permissions
if test ! -f "$conf_file" ; then # ensure the conf file exists
cp "/etc/resolv.conf" "$conf_file"
echo "$server1" >> $conf_file
echo "$server2" >> $conf_file
fi
if ! [ -w "/etc/resolv.conf" -a -w "$conf_file" -a -w "$dhcp_file" ]; then
echo "Permission denied"
exit 1
fi
if test $ENABLE; then
enable_family
if test $NETWORK; then
advertise_enable
fi
elif test $DISABLE; then
disable_family
if test $NETWORK; then
advertise_disable
fi
fi
<?xml version="1.0" encoding="utf-8"?>
<page xmlns="http://projectmallard.org/1.0/"
type="topic" style="task"
id="controle-parental">
<info>
<link type="guide" xref="index" />
<revision version="0.1" date="2017-11-28" status="stub"/>
<credit type="author copyright">
<name>Rafael Sanfelice Castilho</name>
<email>rsc15@inf.ufpr.br</email>
<years>2017</years>
</credit>
<desc>Como gerenciar o controle parental</desc>
</info>
<title>Controle Parental(family shield)</title>
<comment>
<cite date="2017-11-28" href="mailto:rsc15@inf.ufpr.br">Rafael Sanfelice Castihlo</cite>
</comment>
<p>O controle parental é habilitado por padrão no Linux Educacional 6 e procura impedir que os usuários acessem sites com contúdo inapropriado. São considerados conteúdos inapropriados: sites de proxy/anonimos, sexuais ou pornograficos ou sites com ameaça de phishing.</p>
<p>Caso o admnistrador do laboratório deseje é possivel habilitar e desabilitar o controle parental via o <gui xref="control-panel">Painel de Controle</gui> do linux educacional.</p>
<p> Caso o administrador deseje utilizar a linha de comando para desligar o controle parental ele pode abrir um terminal e usar o comando <gui>sudo familhy-shield -d</gui> que retornará "Family Shield disabled".</p>
<p> Posteriormente o controle parental pode ser habilitado novamente com o comando <gui>sudo family-shield -e</gui>, que retornará "Family Shield enabled", confirmando a operação.</p>
<p>É possivel ainda aplicar as mudanças do Controle Parental em toda a rede local. Para isso, basta usar a opção -n junto com as opções <gui>-d</gui> ou <gui>-e</gui>(<gui>sudo family-shield -d -n</gui>).</p>
<note>
<p>Aviso: pode ser necessário reiniciar o computador para que as mudanças sejam percebidas na navegação</p>
<p>Ativar o family sheild na rede não necessariamente ativa o family shield na sua máquina, pode ser necessario ativá-lo localmente</p>
</note>
</page>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment