From f08fb73d6ab98b26e738d89b59f21c2f72b432a6 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 27 Feb 2020 17:24:33 +0200 Subject: Add missing copylefts; improve docs --- examples/README | 47 +++++++++++++++++++++++++++++++++++++++++++++++ examples/dbload | 15 +++++++++++++++ examples/inspect | 15 +++++++++++++++ lib/apr.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ lib/base64.c | 16 ++++++++++++++++ lib/basicauth.c | 17 +++++++++++++++++ lib/md5.h | 17 +++++++++++++++++ src/defs.h | 17 +++++++++++++++++ src/json.c | 17 +++++++++++++++++ src/json.h | 17 +++++++++++++++++ src/mem.c | 17 +++++++++++++++++ src/ping903.conf | 21 +++++++++++++++++++++ src/ping903q.c | 16 ++++++++++++++++ src/strsplit.c | 16 ++++++++++++++++ src/wrapacl.c | 18 ++++++++++++++---- 15 files changed, 306 insertions(+), 4 deletions(-) create mode 100644 examples/README diff --git a/examples/README b/examples/README new file mode 100644 index 0000000..f5a1c50 --- /dev/null +++ b/examples/README @@ -0,0 +1,47 @@ +* Overview + +This directory contains example Perl scripts that access ping903 +facilities via REST API. You can use them as templates for writing +your own configuration system, or just run them as they are, if you +prefer. + +* Programs + + - inspect + Queries the daemon for its configuration settings and displays + them on stdout in the format of ping903 configuration file. + + - ipadd + Adds IP address to the list of addresses monitored by ping903. + + - ipdel + Removes IP address from the list of monitored addresses. + + - dbload + Populates the list of monitored addresses from a SQL database. + +All these programs use the LWP::Ping903 module, which provides support +for parsing the ".ping903.cred" file. The source file for the module is +lib/LWP/Ping903.pm. To run the programs from the examples directory, +define the following environment variable: + + export PERL5LIB=lib + +If you don't plan to use basic authorization, you can get rid of this +dependency using the following command: + + sed -i 's/LWP::Ping903/LWP::UserAgent/' inspect ipadd ipdel dbload + +* Documentation + +Each example is self-documented. To access the description, run the +script with the --help option, or do "perldoc PROG". + + +Local Variables: +mode: outline +paragraph-separate: "[ ]*$" +version-control: never +End: + + diff --git a/examples/dbload b/examples/dbload index f3e9ec2..245ace2 100755 --- a/examples/dbload +++ b/examples/dbload @@ -2,6 +2,21 @@ #! -*-perl-*- eval 'exec perl -x -S $0 ${1+"$@"}' if 0; +# This file is part of Ping903 +# Copyright (C) 2020 Sergey Poznyakoff +# +# Ping903 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, or (at your option) +# any later version. +# +# Ping903 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 Ping903. If not, see . =head1 NAME diff --git a/examples/inspect b/examples/inspect index 6aacad4..8af9b25 100755 --- a/examples/inspect +++ b/examples/inspect @@ -2,6 +2,21 @@ #! -*-perl-*- eval 'exec perl -x -S $0 ${1+"$@"}' if 0; +# This file is part of Ping903 +# Copyright (C) 2020 Sergey Poznyakoff +# +# Ping903 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, or (at your option) +# any later version. +# +# Ping903 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 Ping903. If not, see . =head1 NAME diff --git a/lib/apr.c b/lib/apr.c index 1036841..d7068e9 100644 --- a/lib/apr.c +++ b/lib/apr.c @@ -1,3 +1,47 @@ +/* + * This is work is derived from material Copyright RSA Data Security, Inc. + * + * The RSA copyright statement and Licence for that original material is + * included below. This is followed by the Apache copyright statement and + * licence for the modifications made to that material. + */ + +/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm + */ + +/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All + rights reserved. + License to copy and use this software is granted provided that it + is identified as the "RSA Data Security, Inc. MD5 Message-Digest + Algorithm" in all material mentioning or referencing this software + or this function. + License is also granted to make and use derivative works provided + that such works are identified as "derived from the RSA Data + Security, Inc. MD5 Message-Digest Algorithm" in all material + mentioning or referencing the derived work. + RSA Data Security, Inc. makes no representations concerning either + the merchantability of this software or the suitability of this + software for any particular purpose. It is provided "as is" + without express or implied warranty of any kind. + These notices must be retained in any copies of any part of this + documentation and/or software. + */ + +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ #include #include #include diff --git a/lib/base64.c b/lib/base64.c index ad07a5a..c7db410 100644 --- a/lib/base64.c +++ b/lib/base64.c @@ -1,3 +1,19 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ #include #include #include diff --git a/lib/basicauth.c b/lib/basicauth.c index 4a94726..50b5585 100644 --- a/lib/basicauth.c +++ b/lib/basicauth.c @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + #include #include #include diff --git a/lib/md5.h b/lib/md5.h index ffbdfb3..19c6756 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + struct MD5Context { uint32_t buf[4]; uint32_t bits[2]; diff --git a/src/defs.h b/src/defs.h index 3b4dbaf..85918ef 100644 --- a/src/defs.h +++ b/src/defs.h @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + #include #ifndef DEFAULT_ADDRESS diff --git a/src/json.c b/src/json.c index d65eb2c..510c7ce 100644 --- a/src/json.c +++ b/src/json.c @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + #include #include #include diff --git a/src/json.h b/src/json.h index 81f6db8..5e320a1 100644 --- a/src/json.h +++ b/src/json.h @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + #include enum json_value_type { diff --git a/src/mem.c b/src/mem.c index 744671e..dd607c5 100644 --- a/src/mem.c +++ b/src/mem.c @@ -1,3 +1,20 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ + #include #include #include diff --git a/src/ping903.conf b/src/ping903.conf index ecc38bf..2f00aeb 100644 --- a/src/ping903.conf +++ b/src/ping903.conf @@ -65,3 +65,24 @@ # #trusted-ip 127.0.0.1 +# It is highly recommended to protect your configuration from unauthorized +# access. To do so, use the htpasswd(1) utility to create a database of +# users that are allowed access to configuration. Supposing this database +# file is /etc/ping903/htpasswd, add the following statement: +# +#auth basic * /config /etc/ping903/htpasswd Exopotamie +# +# The 'Exopotamie' word in the above statement is the authentication realm +# name. Replace it with whatever name you deem appropriate. + +# To limit write access to the configuration while allowing anybody to read +# the configuration, use the following +# +#auth basic POST /config /etc/ping903/htpasswd Exopotamie +#auth basic PUT /config +#auth basic DELETE /config + +# For more details about basic authorization, please see the following: +# ping903.conf(5) +# ping903q(1), subsection "Basic authorization" +# ping903.cred(5) \ No newline at end of file diff --git a/src/ping903q.c b/src/ping903q.c index a9024c7..6f84250 100644 --- a/src/ping903q.c +++ b/src/ping903q.c @@ -1,3 +1,19 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ #include #include #include diff --git a/src/strsplit.c b/src/strsplit.c index c2e1eac..3846cbf 100644 --- a/src/strsplit.c +++ b/src/strsplit.c @@ -1,3 +1,19 @@ +/* This file is part of Ping903 + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . +*/ #include #include #include diff --git a/src/wrapacl.c b/src/wrapacl.c index f195f04..db336e4 100644 --- a/src/wrapacl.c +++ b/src/wrapacl.c @@ -1,8 +1,18 @@ /* This file is part of Ping903 -Copyright (C) 2020 Sergey Poznyakoff -License GPLv3+: GNU GPL version 3 or later -This is free software: you are free to change and redistribute it. -There is NO WARRANTY, to the extent permitted by law. + Copyright (C) 2020 Sergey Poznyakoff + + Ping903 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, or (at your option) + any later version. + + Ping903 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 Ping903. If not, see . */ #include #include -- cgit v1.2.1